<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Class Push extends MY_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->data['controller'] = 'push';
        $this->load->model('Mpush');
    }

    public function pushNotification(){
        
        $this->load->library('form_validation');
		$this->form_validation->set_rules('notification', 'Nội dung Push', 'required');
        
        if($this->form_validation->run() === TRUE)
        {
            $notification = @$_REQUEST['notification'];
            $this->data['data'] = $this->Mpush->pushAll($notification);
            if($this->data['data'] == 200){
                die('<meta charset="utf-8"><script>alert("Gửi thành công");window.location.href="'.$this->data['baseurl'].'manage/control/push";</script>');
            }
        }
        
        $this->data['action'] = 'notification';
        $this->load->view('template/layout', $this->data);
    }
    
}